Based on literature structures, we proposed a pharmacophore for NOP receptor ligands and used it as a guide for the design of a focused piperidine library and an optimization library. Potent NOP receptor agonists and antagonists were obtained from these libraries as well as a few potent, mu selective agonists.